home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 1998 January / PC Answers Issue 49 Cover CD January 1998.iso / Apps / Director / DATA.Z / Widget Wizard.dir / WidgtBehaviors_18_button 2 picts.ls < prev    next >
Encoding:
Text File  |  1997-05-10  |  1.4 KB  |  60 lines

  1. property UpCM, DownCM, button_active
  2.  
  3. on getPropertyDescriptionList
  4.   set description to [:]
  5.   if the currentSpriteNum = 0 then
  6.     set memdefault to 0
  7.   else
  8.     set memref to the member of sprite the currentSpriteNum
  9.     set castLibNum to the castLibNum of memref
  10.     set memdefault to member (the memberNum of member memref + 1) of castLib castLibNum
  11.   end if
  12.   addProp(description, #DownCM, [#default: memdefault, #format: #bitmap, #comment: "Pict for Down:"])
  13.   return description
  14. end
  15.  
  16. on getBehaviorDescription
  17.   return "Button, auto set up pict, switch pict down"
  18. end
  19.  
  20. on getAssocMembers
  21.   set myPropList to [DownCM]
  22.   return myPropList
  23. end
  24.  
  25. on beginSprite me
  26.   set the UpCM of me to the member of sprite the spriteNum of me
  27.   set the button_active of me to 0
  28.   puppetSprite(the spriteNum of me, 1)
  29. end
  30.  
  31. on endSprite me
  32.   puppetSprite(the spriteNum of me, 0)
  33. end
  34.  
  35. on mouseDown me
  36.   set the member of sprite the spriteNum of me to member the DownCM of me
  37.   set the button_active of me to 1
  38. end
  39.  
  40. on mouseUp me
  41.   set the member of sprite the spriteNum of me to member the UpCM of me
  42.   set the button_active of me to 0
  43. end
  44.  
  45. on mouseUpOutSide me
  46.   set the button_active of me to 0
  47. end
  48.  
  49. on mouseLeave me
  50.   if the button_active of me then
  51.     set the member of sprite the spriteNum of me to member the UpCM of me
  52.   end if
  53. end
  54.  
  55. on mouseEnter me
  56.   if the button_active of me then
  57.     set the member of sprite the spriteNum of me to member the DownCM of me
  58.   end if
  59. end
  60.